#include <windows.h>

#include "CustomFiberThread.h"

#include "../ScriptHook/ScriptHookManager.h"
#include "../ScriptHook/Log.h"
#include "../ScriptHook/LoggerODS.h"
#include "../ScriptHook/LoggerFile.h"

static CustomFiberThread _customThread;

BOOL APIENTRY DllMain( HANDLE hModule, DWORD  fdwReason, LPVOID lpReserved)
{
    switch (fdwReason)
    {
        case DLL_PROCESS_ATTACH: 
        {
			// Initialize loggers
			Log::AddLogger( LoggerODS::GetInstance() );
			Log::AddLogger( LoggerFile::GetInstance() );

			// Initialize the script hook manager and register threads
			ScriptHookManager::Initialize();
			ScriptHookManager::RegisterThread( &_customThread );

            break;
        }
        case DLL_PROCESS_DETACH:
        {
			// Shutdown the script hook manager
			ScriptHookManager::Shutdown();

            break;
        }
    }

    return TRUE;
}